#ifndef _FAN_H
#define _FAN_H


#include "sn_config.h"

/**
 *  FNN_UP_IMM---->FAN_DOWN_DEAY----->FAN_STABEL---->FAN_CLOSE_DELAY---->FAN_CLOSE
*/
enum FAN_STATE {
    FAN_CLOSE, //关闭风扇
    FAN_CLOSE_DELAY, //1分钟后关闭风扇0%
    FAN_STABEL,//风速维持不变 
    FAN_DOWN_DELAY,//1分钟后风速减小到20%
    FAN_UP_IMM, //风速立即升高
};
struct fan_dev_t
{
    uint8_t count;//延时计数 
    uint8_t  speed;/*速度值百分数0-100*/
    enum FAN_STATE state;
    void (*hal_set_speed)(uint8_t speed);
    void (*dev_handler)(struct fan_dev_t *dev);
    void (*set_speed)(struct fan_dev_t *dev,uint8_t value);
    uint8_t (*get_speed)(void);
    void(*start_wait)(struct fan_dev_t *dev);//开始等待1分钟
    void(*stop_wait)(struct fan_dev_t *dev);//停止等待1分钟
    uint8_t (*waitting)(struct fan_dev_t *dev);//等待返回1 切换状态，返回0 不变
		void(*disable)(void);
		void(*enable)(void);
};

void fan_init(struct fan_dev_t **dev);

#endif // !_FAN_H
